//
//  TianMaoDao.m
//  investevent
//
//  Created by jiangshao on 17/4/8.
//  Copyright © 2017年 com.scj.investevent. All rights reserved.
//

#import "TianMaoDao.h"

@implementation TianMaoDao

-(void)getCoupon:(NSString *)productId{
    [self login];
    // 1.初始化单例类
//    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
//    // 2.设置非校验证书模式
//    manager.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
//    manager.securityPolicy.allowInvalidCertificates = YES;
//    [manager.securityPolicy setValidatesDomainName:NO];
//
//    NSString *url=[NSString stringWithFormat: @"https://cart.taobao.com/json/GetPriceVolume.do?sellerId=%@",productId];
//    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
//    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
//    
//
////    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
//    [manager GET:url parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
//        NSString *result = [[NSString alloc] initWithData:responseObject  encoding:NSUTF8StringEncoding];
//        //        NSArray *array=[responseObject objectForKey:@"data"];
//        NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
//        NSLog(@"成功");
//    } failure:^(NSURLSessionDataTask *task, NSError *error) {
//        NSLog(@"失败");
//        NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
//    }];

}

-(void)login{
    // 1.初始化单例类
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    // 2.设置非校验证书模式
    manager.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
    manager.securityPolicy.allowInvalidCertificates = YES;
    [manager.securityPolicy setValidatesDomainName:NO];
    
    NSString *url=[NSString stringWithFormat: @"https://login.taobao.com/member/login.jhtml?redirectURL=http%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1&TPL_username=fzmtn&TPL_password=&ncoSig=&ncoSessionid=&ncoToken=2c7cc607ddb8d39d8488546d2c3911c617c05527&slideCodeShow=false&useMobile=false&lang=zh_CN&loginsite=0&newlogin=0&TPL_redirect_url=http%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1&from=alimama&fc=default&style=mini&css_style=&keyLogin=false&qrLogin=true&newMini=false&newMini2=true&tid=&loginType=3&minititle=&minipara=&pstrong=&sign=&need_sign=&isIgnore=&full_redirect=true&sub_jump=&popid=&callback=&guf=&not_duplite_str=&need_user_id=&poy=&gvfdcname=10&gvfdcre=687474703A2F2F7777772E616C696D616D612E636F6D2F6D656D6265722F6C6F67696E2E68746D3F666F72776172643D6874747025334125324625324661642E616C696D616D612E636F6D2532466D79756E696F6E2E68746D25334673706D253344613231616E2E373730353730392E313939383532303836302E332E4E4C5541536E&from_encoding=&sub=&TPL_password_2=0b7fa1968df4887c8202e6adb09bb1a5c0941715f40270a629386044a454ae55da1c88cb4a891986d0d0b6f24b7c0ef98ec8ba03229005a20a5330905c483183ac886be88bbf68de1fb974aa30adfdc57ab2446f00612f44178f2d1bdc9c5f42a939a48948735b4e576c94aaae54a414b059978da261dc45f4451691464111e8&loginASR=1&loginASRSuc=1&allp=&oslanguage=zh-CN&sr=1920*1200&osVer=windows%7C6.1&naviVer=chrome%7C57.02987133&osACN=Mozilla&osAV=5.0+%28Windows+NT+6.1%3B+WOW64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F57.0.2987.133+Safari%2F537.36&osPF=Win32&miserHardInfo=&appkey=&nickLoginLink=&mobileLoginLink=https%3A%2F%2Flogin.taobao.com%2Fmember%2Flogin.jhtml%3Fstyle%3Dmini%26newMini2%3Dtrue%26from%3Dalimama%26redirectURL%3Dhttp%3A%2F%2Flogin.taobao.com%2Fmember%2Ftaobaoke%2Flogin.htm%3Fis_login%3D1%26full_redirect%3Dtrue%26disableQuickLogin%3Dtrue%26useMobile%3Dtrue&showAssistantLink=&um_token=HV01PAAZ0bb7adc0dcfa1bdc58e9c95d00bec578&ua=089%236o5vLvvn%2BclvyJ%2Bevvvvv964Zu49%2B5EBpf5thJpRlH%2B%2FZQjGoK%2FpDl9XOuMRI%2F7UQf0Uh5FslH%2BlOBTrT5pvEN%2Bdhuw5Lu8%2Bv%2BusIpL9RUVF12hZYVkfSzs%2BzDTaE"];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    
    //    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
    [manager POST:url parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        NSString *result = [[NSString alloc] initWithData:responseObject  encoding:NSUTF8StringEncoding];
        //        NSArray *array=[responseObject objectForKey:@"data"];
        NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
        NSLog(@"成功");
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"失败");
        NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
    }];
    
}


@end
